//
//  MHLocationManager.h
//  MiaoCircle
//
//  Created by 许正荣 on 2018/9/25.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapSearchKit/AMapSearchKit.h>
#import <MAMapKit/MAMapKit.h>
#import <AMapLocationKit/AMapLocationKit.h>


@protocol MHLocationManagerAppdelegate<NSObject>
@optional
- (void)mhmapLocationManager:(AMapLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
@end


@interface MHLocationManager : NSObject

@property (nonatomic, strong) AMapSearchAPI *search;

@property(nonatomic, weak) id<MHLocationManagerAppdelegate> delegate;

@property (nonatomic, strong) AMapLocationManager *locationManager;

/**
 定位Block
 */
@property(nonatomic, copy) VoidBlock_id updateLocationBlock;

@property(nonatomic, copy) VoidBlock_int changeAuthorizationBlock;

@property(nonatomic, copy) VoidBlock_id geocodeBlock;


/**
 搜索周边Block
 */
@property(nonatomic, copy) VoidBlock_id_id searchAroundBlock;


//@property(nonatomic, copy) VoidBlock_id searchAroundKeyworldBlock;


+ (instancetype)sharedInstance;
//跳转至设置开启定位
- (void)openLocationSetting;

//检测是否开启了定位
+ (BOOL)isLocationServiceOpen;

/**
 更新本地信息到服务器

 @param location 用户当前定位的点
 */
+(void) uploadLocationToRemote:(CLLocation *)location;


/**
 开启定位

 @param updateLocationBlock 定位的回调
 */
-(void) startUpdatingLocationWithBlock:(VoidBlock_id) updateLocationBlock;



/**
 地址转坐标

 @param address 地址
 @param geoBlock 转换的Block
 */
-(void) geocodeSearchWithAddress:(NSString *) address geoBlock:(VoidBlock_id) geoBlock;


/**
 搜索周边

 @param location 当前位置
 @param reslutBlock 周边的兴趣点
 */
-(void) searhAroundWithLocation:(CLLocation *) location reslutBlock:(VoidBlock_id_id) reslutBlock;


/**
 根据关键词搜索周边

 @param keyWorld 关键词
 @param location 当前位置
 @param reslutBlock 返回相关的兴趣点
 */
-(void) searhAroundWithKeyWorld:(NSString *)keyWorld location:(CLLocation *) location reslutBlock:(VoidBlock_id_id) reslutBlock;

@end
